<template>
  <div v-if="topicInfo" class="topic">
    <div class="title">{{ topicInfo.title }} </div>
    <div v-if="topicInfo.interactive && topicInfo.interactive.length > 0" class="right">
      <div v-for="(item, index) in topicInfo.interactive" :key="index" class="interactive" @click="clickInteractive(item)">
        {{ item.info }}
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Topic',
  props: {
    topicInfo: {
      default: null,
      type: Object
    }
  },
  methods: {
    // 捕获点击事件 抛出去
    clickInteractive(item) {
      this.$emit(item.click, item)
    }
  }
}
</script>

<style lang="scss" scoped>
    .topic {
        width: 100%;
        height: 40px;
        line-height: 40px;
        color: #fff;
        background: #04C1C2;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 16px;
        font-weight: 500;
        padding: 0 25px;
        border-radius: 4px;
        margin-bottom: 20px;
        .title {
            flex: 1;
            // color: #666;
            font-size: 16px;
            font-weight: bold;
            // color: #333;
        }
        .right {
            display: flex;
            justify-content: flex-end;
            .interactive {
                margin-right: 10px;
                cursor: pointer;
            }
        }

    }
</style>
